{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "332126f9-3524-4223-bcc6-24b9818b77b5",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "from mythic import mythic"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "abfa531f-5e7a-400b-910c-92a62106ccbe",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "mythic_instance = await mythic.login(\n",
    "        username=\"mythic_admin\",\n",
    "        password=\"mythic_password\",\n",
    "        server_ip=\"mythic_nginx\",\n",
    "        server_port=7443,\n",
    "        timeout=-1\n",
    "    )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "77b89409-31c8-44d8-877f-bec19f261e01",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# ################ create a new operator (password must be at least 12 characters long) ################\n",
    "result = await mythic.create_operator(mythic=mythic_instance, username=\"charlie\", password=\"testtesttest\")\n",
    "print(result)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d029a470-2705-40b3-8fac-a82cc5c21648",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# ################ create a new apitoken for the current user ################\n",
    "token = await mythic.create_apitoken(mythic=mythic_instance)\n",
    "print(token)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9a0c718f-6a19-4382-ad75-d0a29064f3e6",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# ################ toggle admin status for a user ################\n",
    "resp = await mythic.set_admin_status(mythic=mythic_instance, username=\"charlie\", admin=True)\n",
    "print(resp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4eeb1e9d-5515-43e8-ac4e-f55580086655",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# ################ toggle active status for a user ################\n",
    "resp = await mythic.set_active_status(mythic=mythic_instance, username=\"charlie\", active=True)\n",
    "print(resp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8a9c478f-9fb4-44dc-a5de-fcab5b817d5f",
   "metadata": {
    "tags": []
   },
   "outputs": [],
   "source": [
    "# ################ change operator's password ################\n",
    "resp = await mythic.set_password(mythic=mythic_instance, username=\"charlie\", new_password=\"mythic_password\")\n",
    "print(resp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2cffc840-f027-4358-954b-3abab7d3e93a",
   "metadata": {},
   "outputs": [],
   "source": [
    "# ################ functions related to operators and operations is in OperatorsAndOperations ################"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
